<?php
/**
 * Created by PhpStorm.
 * User: ly
 * Date: 2018\2\7 0007
 * Time: 16:55
 */
?>

<style>
    .modal-body-div .form-group #fdContent label {
        width: auto;
        padding: 0 10px;
        font-weight: normal;
    }
    .modal-body-div .form-group #fdContent label.active {
        color: #2194f1!important;
    }

</style>
<div class="modal-dialog" role="document">
    <div class="modal-content">
        <?php
        if($eidtFlage){
        ?>
        <form>
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><img src="/image/assetPackage/close.png"></span></button>
            <div class="pull-left modal-nav">
                <img src="/image/assetPackage/white.png" class="pull-left">
                <span class="pull-left">请输入编辑内容</span>
            </div>
        </div>
        <div class="modal-body">
            <div class="modal-body-div">
                <div class="form-group clearfix">
                    <label for="fd" id="fdShowName" style="width: auto" class="pull-left control-label "><?php echo $data['fdShowName'];?>：</label>
                    <?php
                        $fd=$data['fd'];
                        switch ($fd) {
                            case 'is_suit'://诉讼情况
                                $isSuit=Yii::$app->params['isSuit'];
                                echo '<select class="pull-left form-control area-select" id="fdContent">';
                                foreach ($isSuit as $key=>$value){
                                    if($key > -2){
                                        $selected=($value['name']==$data['content']?'selected':'');
                                        echo '<option value="'.$key.'"  '.$selected.'>'.$value['name'].'</option>';
                                    }
                                }
                                echo '</select>';
                                break;
                            case 'management_status'://借款人状况
                                $borrowerStates=Yii::$app->params['borrowerStates'];
                                echo '<select class="pull-left form-control area-select" id="fdContent">';
                                foreach ($borrowerStates as $key=>$value){
                                    $selected=($value['name']==$data['content']?'selected':'');
                                    echo '<option value="'.$key.'"  '.$selected.'>'.$value['name'].'</option>';
                                }
                                echo '</select>';
                                break;
                            case 'enterprise'://企业
                                $project_enterprise=Yii::$app->params['project_enterprise'];
                                echo '<select class="pull-left form-control area-select" id="fdContent">';
                                foreach ($project_enterprise as $key=>$value){
                                    $selected=($value==$data['content']?'selected':'');
                                    echo '<option value="'.$key.'"  '.$selected.'>'.$value.'</option>';
                                }
                                echo '</select>';
                                break;
                            case 'industry'://行业
                                echo '<strong class="labelActiveBox pull-left" id="fdContent">';
                                $industryVal = !empty($data['content']) ? array_filter(explode(',',$data['content'])) :'';
                                $industrys = Yii::$app->params['industrys'];
                                foreach ($industrys as $k => $v){
                                    $name = $v['name'];
                                    $val  = $v['val'];
                                    if (!empty($industryVal) && in_array($name,$industryVal)){
                                        echo "<label val=".$val."  class='active'>".$name."</label>";
                                    }else{
                                        echo "<label val=".$val." >".$name."</label>";
                                    }
                                }
                                echo '</strong>';
                                break;
                            case 'mortgage_type'://mortgage_type抵押物类型
                                echo '<strong class="labelActiveBox pull-left" id="fdContent">';
                                $mortgageVal = !empty($data['content']) ? array_filter(explode(',',$data['content'])) :'';
                                $mortgages = Yii::$app->params['mortgageTypes3'];
                                foreach ($mortgages as $k => $v){
                                    $name = $v['name'];
                                    $val  = $v['val'];
                                    if (!empty($mortgageVal) && in_array($name,$mortgageVal)){
                                        echo "<label val=".$val."  class='active'>".$name."</label>";
                                    }else{
                                        echo "<label val=".$val." >".$name."</label>";
                                    }
                                }
                                echo '</strong>';
                                break;
                            case 'is_first_mortgage'://is_first_mortgage是否首押
                                echo '<div class="labelActiveBox pull-left" id="fdContent">';
                                echo '<label for="firstYes">是<input type="radio" value="1" name="is_first_mortgage" id="firstYes"></label>
                                        <label for="firstNo">否<input type="radio" value="2" name="is_first_mortgage" id="firstNo"></label>
                                        ';
                                echo '</div>';
                                break;

                            case 'is_first_seal'://is_first_seal是否首封IsFirstSeal
                                echo '<div class="labelActiveBox pull-left" id="fdContent">';
                                echo '<label for="firstYes">是<input type="radio" value="1" name="is_first_mortgage" id="firstYes"></label>
                                      <label for="firstNo">否<input type="radio" value="2" name="is_first_mortgage" id="firstNo"></label>
                                        ';
                                echo '</div>';
                                break;
                            default:
                                echo '<textarea class="form-control textarea-edit  pull-left" style="min-height: 34px;" id="fdContent">'.$data['content'].'</textarea>';
                        }
                    ?>
                    <input type="hidden" name="fd" id="fd" value="<?php echo $data['fd'];?>">
                    <input type="hidden" name="tb" id="tb" value="<?php echo $data['tb'];?>">
                    <input type="hidden" name="keyId" id="keyId" value="<?php echo $data['keyId'];?>">
                    <input type="hidden" name="type" id="type" value="<?php echo $data['type'];?>">
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default btns-primary" data-dismiss="modal">取消</button>
            <button type="button" class="btn btn-primary btns-primary" id="EditFieldSub">保存</button>
        </div>
        </form>
        <?php }else{ ?>
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><img src="/image/assetPackage/close.png"></span></button>
                <div class="pull-left modal-nav">
                    <img src="/image/assetPackage/white.png" class="pull-left">
                    <span class="pull-left">请输入编辑内容</span>
                </div>
            </div>
            <div class="modal-body">
                <div class="modal-body-div">
                    <div class="form-group clearfix">
                <label for="fd" id="fdShowName" style="width: auto" class="pull-left control-label "><?php echo $data['fdShowName'];?>：</label>
                <textarea class="form-control textarea-edit  pull-left" style="min-height: 20px;" disabled><?php echo $data['content'];?></textarea>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary btns-primary" data-dismiss="modal">返回</button>
            </div>
        <?php } ?>
    </div>
</div>
<script>
    $(function(){
        $("#fdContent label").click(function () {
            if ($(this).hasClass("active")){
                $(this).removeClass("active")
            }else{
                $(this).addClass("active");
            }
        });
    });
</script>
